package com.bwie.auth.controller;

import com.bwie.auth.service.AuthUserService;
import com.bwie.common.domain.request.UserRequest;
import com.bwie.common.domain.response.UserResponse;
import com.bwie.common.result.Result;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @className: AuthUserController
 * @Description: TODO
 * @version: v1.８.0
 * @author: 张雨乐
 * @date: 2025/10/22 9:39
 */
@CrossOrigin
@RestController
public class AuthUserController {
    @Autowired
    AuthUserService authUserService;

    /**
     * 账号密码登录
     * @param userRequest
     * @return
     */
    @PostMapping("nameLogin")
    public Result nameLogin(@RequestBody UserRequest userRequest){
        return authUserService.nameLogin(userRequest);
    }
    /**
     * 手机号登录
     * @param userRequest
     * @return
     */
    @PostMapping("phoneLogin")
    public Result phoneLogin(@RequestBody UserRequest userRequest){
        return authUserService.phoneLogin(userRequest);
    }

    /**
     * 发送图片验证码
     * @return
     */
    @GetMapping("code")
    public Result code(){
        return authUserService.code();
    }
    /**
     * 发送验证码
     * @return
     */
    @PostMapping("phoenCode")
    public Result phoenCode(@RequestBody UserRequest userRequest){
        return authUserService.phoenCode(userRequest);
    }


}
